package tue.cse.advanceddatabases.project.xml.album;

import java.util.List;
import java.util.Vector;
import java.util.logging.Logger;

import org.dom4j.Element;

public class AlbumsParser {
	private static Logger logger = Logger.getLogger(AlbumsParser.class.getName());
	
	public static List<Album> parse(List<Element> albumsElement) {
		return parse(albumsElement.get(0));
	}
	
	public static List<Album> parse(Element albumsElement) {
		List<Album> albums = new Vector<Album>();
		
		List<Element> albumElements = albumsElement.elements();
		
		logger.info("Number of Albums are:" + albumElements.size());
		for (int i=0; i< albumElements.size();i++){
			Element element = albumElements.get(i);
			albums.add(new Album(element));
		}
		return albums;
	}

}